<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us" lang="en-us">
<head>
  <link href="//gmpg.org/xfn/11" rel="profile">
  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  <meta name="generator" content="Hugo 0.69.0" />

  
  <meta name="viewport" content="width=device-width, initial-scale=1.0">

  <title>Day06 &middot; 我的博客</title>

  
  <link type="text/css" rel="stylesheet" href="/myhugo/css/print.css" media="print">
  <link type="text/css" rel="stylesheet" href="/myhugo/css/poole.css">
  <link type="text/css" rel="stylesheet" href="/myhugo/css/syntax.css">
  <link type="text/css" rel="stylesheet" href="/myhugo/css/hyde.css">
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Abril+Fatface|PT+Sans:400,400i,700">


  
  <link rel="apple-touch-icon-precomposed" sizes="144x144" href="/apple-touch-icon-144-precomposed.png">
  <link rel="shortcut icon" href="/favicon.png">

  
  
</head>

  <body class="theme-base-0d ">
  <aside class="sidebar">
  <div class="container sidebar-sticky">
    <div class="sidebar-about">
      <a href="/myhugo/"><h1>我的博客</h1></a>
      <p class="lead">
       小白的逆袭之旅 
      </p>
    </div>

    <nav>
      <ul class="sidebar-nav">
        <li><a href="/myhugo/">Home</a> </li>
        
      </ul>
    </nav>

    <p>&copy; 2020. All rights reserved. </p>
  </div>
</aside>

    <main class="content container">
    <div class="post">
  <h1>Day06</h1>
  <time datetime=2020-04-27T22:12:11&#43;0800 class="post-date">Mon, Apr 27, 2020</time>
  <pre><code>查看当前docker中的所有镜像：docker images

显示版本号：docker -v

进入虚拟机：docker-machine ssh 
            例：进入默认虚拟机：docker-machine ssh default

重启镜像：docker-machine restart default

查看所有docker内容：docker info

将镜像导出到位置/保存镜像：docker save -o '导出路径位置' redis/镜像名

删除镜像：docker rmi -f 975f/镜像ID

导入镜像：docker load -i 'D:\Program Files (x86)\docker\docker镜像\redis1.tar'/路径

查看所有容器：docker ps -a

查看正在运行的容器：docker ps

关闭正在运行的容器：docker stop 镜像ID(docker ps中的ID)

删除容器：docker rm $(docker ps -a(所有容器) -q(quit,已经退出的容器))
          例：docker rm $(docker ps -a -q)

后台启动服务和端口映射：docker run -p 主机未使用ip:服务端默认ip 镜像名称 服务名称  
                       例：docker run -p 6380:6379 redis redis-server

查看镜像服务：docker run -ti 镜像id
              例：docker run -ti 975f

查看ip：docker-machine ip default

退出镜像：exit
</code></pre>
</div>


    </main>

    
  </body>
</html>
